import { createPinia } from 'pinia';
import { createUnistorage } from 'pinia-plugin-unistorage';
import uviewPlus from 'uview-plus';
import { createSSRApp } from 'vue';
import App from './App.vue';
// 导入UnoCSS样式
// import 'virtual:uno.css';

import { initRequest } from '@/api/request/index.js';
import { http } from 'uview-plus';
uni.$u = {
  http
};

export function createApp() {
  const app = createSSRApp(App);
  const pinia = createPinia();

  // 配置 Pinia 持久化插件
  pinia.use(createUnistorage());

  app.use(pinia);
  app.use(uviewPlus);
  initRequest(app);

  return {
    app
  };
}
